<template>
	<div class="vue-uploader">
		<div class="dialogCare">
			<span>hello word!</span> //要打印的内容
		</div>

		<button @click="printBtn()">打 印</button>
	</div>
</template>
<script>
	export default {
		data() {
			return {}
		},
		methods: {
			printBtn() {
				let newstr = document.getElementsByClassName('dialogCare')[0].innerHTML;
				console.log(newstr)
				window.document.body.innerHTML = newstr;
				let oldstr = window.document.body.innerHTML;
				window.print();
				window.location.reload(); //解决打印之后按钮失效的问题
				window.document.body.innerHTML = oldstr;
				return false;
			}
		}
	}
</script>